﻿<Window x:Class="OpenPOS.Views.ShellView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:system="clr-namespace:System.Windows;assembly=PresentationCore"
        xmlns:prismcmd="clr-namespace:Microsoft.Practices.Composite.Presentation.Commands;assembly=Microsoft.Practices.Composite.Presentation"
        xmlns:prismrgn="clr-namespace:Microsoft.Practices.Composite.Presentation.Regions;assembly=Microsoft.Practices.Composite.Presentation"
        xmlns:lib="clr-namespace:PixelLab.Wpf.Transitions;assembly=PixelLab.Wpf"
        xmlns:local="clr-namespace:OpenPOS.Properties"
             xmlns:controls="clr-namespace:OpenPOS.Controls;assembly=OpenPOS.Controls"
        
        Title="OpenPOS" MinHeight="768" MinWidth="1024" 
        
        Height="{Binding Source={x:Static local:Settings.Default}, Path=Height, Mode=TwoWay}" 
        Width="{Binding Source={x:Static local:Settings.Default}, Path=Width, Mode=TwoWay}"
        Left="{Binding Source={x:Static local:Settings.Default}, Path=Left, Mode=TwoWay}" 
        Top="{Binding Source={x:Static local:Settings.Default}, Path=Top, Mode=TwoWay}"
        WindowState="{Binding Source={x:Static local:Settings.Default}, Path=WindowState, Mode=TwoWay}"
        WindowStyle="{Binding Source={x:Static local:Settings.Default}, Path=WindowStyle, Mode=TwoWay}"

        KeyDown="Window_KeyDown"
        
        Icon="../Images/OpenPOS.ico"
        Loaded="Window_Loaded"
        Closed="Window_Closed"
        mc:Ignorable="d">
    <Grid x:Name="LayoutRoot" Background="{DynamicResource WindowBackgroundBrush}">
        <Grid.RowDefinitions>
            <RowDefinition Height="45"/>
            <RowDefinition/>
            <RowDefinition Height="30"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>

        <!-- Header -->
        <Border BorderThickness="0,0,0,1" Grid.Row="0" Grid.ColumnSpan="3" Margin="0,0,0,5" BorderBrush="#AAAAAA" Background="{DynamicResource ShadeBrush}">
            <Grid>
                <TextBlock Text="{Binding Source={x:Static local:Settings.Default}, Path=Title}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{DynamicResource TextBrush}" />
            </Grid>
        </Border>    
        
        <!-- Navigation Region -->
        <Border Margin="8,2,0,2" Grid.Row="1" Grid.Column="0" BorderBrush="#AAAAAA" BorderThickness="1,1,1,1" CornerRadius="4,4,4,4" Background="{DynamicResource ShadeBrush}" Visibility="{Binding NavigationPaneVisibility}" Width="225">
        	<ContentControl x:Name="NavigationRegion" prismrgn:RegionManager.RegionName="NavigationRegion"
                            Style="{StaticResource ContentControlRegionStyle}"
        		            VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"/>
        </Border>

        <!-- Content Region -->
        <Border Margin="8,2,8,2" Grid.Column="2" Grid.Row="1" BorderThickness="1,1,1,1" CornerRadius="4,4,4,4" BorderBrush="#AAAAAA" Background="{DynamicResource ShadeBrush}">
            <Grid>
                <ContentControl x:Name="ContentRegion" prismrgn:RegionManager.RegionName="ContentRegion"
        		                Style="{StaticResource ContentControlRegionStyle}"
                                VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch">
                    <ContentControl.Template>
                        <ControlTemplate TargetType="{x:Type ContentControl}">
                            <lib:TransitionPresenter Content="{TemplateBinding Content}">
                                <lib:TransitionPresenter.Transition>
                                    <lib:StoryboardTransition TextSearch.Text="Fade And Grow" IsNewContentTopmost="False">
                                        <lib:StoryboardTransition.OldContentStyle>
                                            <Style TargetType="ContentPresenter">
                                                <Setter Property="RenderTransformOrigin" Value="0.5, 0.5"/>
                                                <Setter Property="RenderTransform">
                                                    <Setter.Value>
                                                        <ScaleTransform ScaleX="1" ScaleY="1"/>
                                                    </Setter.Value>
                                                </Setter>
                                            </Style>
                                        </lib:StoryboardTransition.OldContentStyle>
                                        <lib:StoryboardTransition.OldContentStoryboard>
                                            <Storyboard>
                                                <DoubleAnimation Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="0:0:0.2"/>
                                                <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" From="1" To="0.95" Duration="0:0:0.2"/>
                                                <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" From="1" To="0.95" Duration="0:0:0.2"/>
                                            </Storyboard>
                                        </lib:StoryboardTransition.OldContentStoryboard>

                                        <lib:StoryboardTransition.NewContentStyle>
                                            <Style TargetType="ContentPresenter">
                                                <Setter Property="RenderTransformOrigin" Value="0.5, 0.5"/>
                                                <Setter Property="RenderTransform">
                                                    <Setter.Value>
                                                        <ScaleTransform ScaleX="1" ScaleY="1"/>
                                                    </Setter.Value>
                                                </Setter>
                                            </Style>
                                        </lib:StoryboardTransition.NewContentStyle>
                                        <lib:StoryboardTransition.NewContentStoryboard>
                                            <Storyboard>
                                                <DoubleAnimation Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="0:0:0.2"/>
                                                <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" From="0.95" To="1" Duration="0:0:0.2"/>
                                                <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" From="0.95" To="1" Duration="0:0:0.2"/>
                                            </Storyboard>
                                        </lib:StoryboardTransition.NewContentStoryboard>
                                    </lib:StoryboardTransition>
                                </lib:TransitionPresenter.Transition>
                            </lib:TransitionPresenter>
                        </ControlTemplate>
                    </ContentControl.Template>
                </ContentControl>
            </Grid>
        </Border>


        <Border BorderThickness="0,1,0,0" Grid.Row="2" Grid.ColumnSpan="3" Margin="0,5,0,0" BorderBrush="#AAAAAA" Background="{DynamicResource ShadeBrush}">
            <Grid>
                <TextBlock Text="{Binding Version}" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="{DynamicResource TextBrush}" Margin="5,0,0,0" />
                <TextBlock Text="{Binding CurrentUser.Name}" HorizontalAlignment="Right" VerticalAlignment="Center" Foreground="{DynamicResource TextBrush}" Margin="0,0,5,0" />
            </Grid>
        </Border>
    </Grid>

</Window>
